﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../../easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../../easyui/themes/icon.css">
    <script src="../../../easyui/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../../../easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#pp').panel({

                modal: true,
                title: 'my panel',
                tools: [
                {
                    iconCls: 'icon-edit',
                    text: 'edit',
                    handler: function () {
                        var row = $('#dg').datagrid('getSelected');
                        if (row) {
                            $('#win').window('open');
                            $('#fm').form('load', row);
                        }
                    }
                },
                {
                    iconCls: 'icon-remove',
                    text: 'remove',
                    handler: function () {
                        var row = $('#dg').datagrid('getSelected');
                        if (row) {
                            $.messager.confirm('Confirm', '确定要删除该条档案吗？', function (r) {
                                if (r) {
                                    $.post(
                                        '../../../Handler/ArchiveHandler.ashx?op=delete&timespan=' + Math.random(),
                                        { dataId: row.dataId },
                                        function (result) {
                                            var r = eval('(' + result + ')');
                                            if (r.success) {
                                                alert('删除成功！');
                                                
                                                //重新发送请求加载数据
                                                $('#dg').datagrid('reload');
                                            }
                                        }
                                    );
                                }
                            });
                        }
                    }
                }
                ]
            });
        });
    </script>
</head>
<body>
    <div id="pp" class="easyui-panel">
        <table id="dg" class="easyui-datagrid" data-options="url:'../../../Handler/ArchiveListHandler.ashx',rownumbers:true,fitColumns:true,singleSelect:true, resizeHandle:'both',striped:true,pagination:true,pagePosition:'both',sortName:'createtime',sortOrder:'desc'">
        <thead>
            <tr>
                <th data-options="field:'DataId',align:'center',width:100,hidden:true">
                    DataId
                </th>
                <th data-options="field:'ArchiveNum',align:'center',width:100">
                    档号
                </th>
                <th style="text-align: center;" data-options="field:'Title',halign:'center',width:200">
                    题名
                </th>
                <th data-options="field:'ArchiveSource',align:'center',width:100">
                    档案来源
                </th>
            </tr>
        </thead>
    </table>
    </div>
    <div id="win" class="easyui-window" data-options="width:400,height:300,title:'Edit User'"
        closed="true">
        <form id="fm" method="post">
        <div>
            <label for="ArchiveNum">
                档号</label>
            <input type="text" name="ArchiveNum"  />
        </div>
        <div>
            <label for="Title">
                标题</label>
            <input type="text" name="Title" class="easyui-validatebox"  data-options="required:true" />
        </div>
        <div>
            <label for="ArchiveSource">
                档案来源</label>
            <input type="text" name="ArchiveSource" />
        </div>
        </form>
    </div>
</body>
</html>
